package com.collabscm.md.base.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.collabscm.pf.model.DomainObject;

/**
 * 人员，系统内所有的人员，包括：可以登录系统的和不可以登录系统的用户都统称为人员。 （与PersonService对应，其中PersonService是Person的业务逻辑）。
 * 
 * @author Zeng Raoxing
 */
@Entity
@Table(name = "t_md_person")
@NamedQueries({
	@NamedQuery(name=Person.QUERY_PERSON, query="from Person where status = :status"),
	@NamedQuery(name=Person.COUNT_QUERY_PERSON, query="select count(*) from Person where status = :status"),
})
public class Person extends DomainObject {
	/**
     * 查询人员
     */
	public static final String QUERY_PERSON = "queryPerson";
    
    /**
     * 查询人员的总数
     */
    public static final String COUNT_QUERY_PERSON = "countQueryPerson";
    
	private static final long serialVersionUID = 1L;
	/**人员ID*/
	private Long personId;
	/**所属组织ID*/
	private Organ organ;
	/**人员姓名*/
	private String personName;
	private String firstName;
	private String familyName;
	/**邮箱*/
	private String mail;
	/**职位*/
	private String job;
	/**职责描述*/
	private String jobDesc;
	/**生日*/
	private Date birthday;
	/**入职时间*/
	private Date onboardDate;
	/**国籍*/
	private Long nationality;

	// Property accessors
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "Person_ID", unique = true, nullable = false, precision = 12, scale = 0)
	public Long getPersonId() {
		return this.personId;
	}

	public void setPersonId(Long personId) {
		this.personId = personId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Organ_ID", nullable = false)
	public Organ getOrgan() {
		return this.organ;
	}

	public void setOrgan(Organ organ) {
		this.organ = organ;
	}

	@Column(name = "Person_Name", nullable = false, length = 60)
	public String getPersonName() {
		return this.personName;
	}

	public void setPersonName(String personName) {
		this.personName = personName;
	}

	@Column(name = "First_Name", length = 60)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name = "Family_Name", length = 60)
	public String getFamilyName() {
		return this.familyName;
	}

	public void setFamilyName(String familyName) {
		this.familyName = familyName;
	}

	@Column(name = "Mail", length = 60)
	public String getMail() {
		return this.mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	@Column(name = "Job", length = 60)
	public String getJob() {
		return this.job;
	}

	public void setJob(String job) {
		this.job = job;
	}

	@Column(name = "Job_Desc", length = 500)
	public String getJobDesc() {
		return this.jobDesc;
	}

	public void setJobDesc(String jobDesc) {
		this.jobDesc = jobDesc;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "Birthday", length = 10)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "Onboard_Date", length = 10)
	public Date getOnboardDate() {
		return this.onboardDate;
	}

	public void setOnboardDate(Date onboardDate) {
		this.onboardDate = onboardDate;
	}

	@Column(name = "Nationality", precision = 8, scale = 0)
	public Long getNationality() {
		return this.nationality;
	}

	public void setNationality(Long nationality) {
		this.nationality = nationality;
	}

}